package com.yhk.wuchat.common.common.config;

import com.yhk.wuchat.common.common.interceptor.BlackInterceptor;
import com.yhk.wuchat.common.common.interceptor.CollectorInterceptor;
import com.yhk.wuchat.common.common.interceptor.TokenInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @version 1.0
 * @Author moresuo
 * @Date 2024/4/8 15:21
 * @注释
 */

/**
 * 拦截器配置类
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    @Resource
    private TokenInterceptor tokenInterceptor;
    @Resource
    private CollectorInterceptor collectorInterceptor;
    @Resource
    private BlackInterceptor blackInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor).addPathPatterns("/capi/**");
        registry.addInterceptor(collectorInterceptor).addPathPatterns("/capi/**");
        registry.addInterceptor(blackInterceptor).addPathPatterns("/capi/**");
    }
}
